package com.wen.api;


import com.wen.pojo.RspResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Map;

//媒资管理接口,提供上传,校验等接口
@Validated
public interface MediaManageApi {

    //文件上传前注册  校验  mimetype文件类型  fileExt 文件扩展名
    public RspResult register(@NotBlank String fileMd5, String fileName, Long fileSize, String mimetype, String fileExt);

    //校验分块文件是否存在 chunk下标
    public RspResult checkChunk(@NotBlank String fileMd5,
                          Integer chunk,
                          Integer chunkSize);

    //上传分块
    public RspResult uploadChunk(@NotNull MultipartFile file,
                           @NotBlank String fileMd5,
                           Integer chunk);

    //合并分块
    public RspResult mergeChunks(@NotBlank String fileMd5,
                           @NotBlank String fileName,
                           Long fileSize,
                           String mimetype,
                           String fileExt);

    //文件下载
    public void download(HttpServletResponse response,@NotBlank String bucketName, @NotBlank String filename);

    //文件删除
    public RspResult delete(@NotBlank String bucketName,@NotBlank String filename);

    //文件预览
    public void preview(HttpServletResponse response,@NotBlank String bucketName,@NotBlank String filename) throws Exception;

    //图片直接上传
   // public Map upImages(@NotNull MultipartFile file, @NotBlank String fileMd5);


}
